/*
 * @(#)Provider.java	1.0 2000/12/14
 *
 * Copyright 2000 Thomas Barnekow. All Rights Reserved.
 *
 * This software is the proprietary information of Thomas Barnekow.
 * Use is subject to license terms.
 */

package tb.provider;

import tb.util.*;

/**
 * This interface is to be implemented by service providers that provide its
 * <i>services</i> relating to a set of <i>entities</i>. Conceivable
 * services include read-write or read-only access to file systems or RDBMSs.
 * Entities, in these cases, would be file servers, directories, and files, or
 * database servers, schemas, and tables. As can be seen from these examples,
 * entities can be <i>containers</i> and/or <i>elements</i>. Therefore, when
 * a service provider provides a service for a container, it effectively provides
 * its service for all contained elements.
 * <p>
 * Service elements can also be structured hierarchically, leading to the
 * notion of a <i>compound service</i> that denotes a service comprising all
 * service elements contained in a given (sub-) hierarchy.
 * <p>
 * <b><i>Example:</i></b> the (database management) service elements "select",
 * "insert", "update", and "delete" can be structured as follows:
 * <p>
 * <table cols=5>
 * <tr><td colspan=1>&nbsp;</td><td colspan=2><b>full</b></td></tr>
 * <tr><td colspan=1>&nbsp;</td><td>+---</td><td colspan=2>select</td></tr>
 * <tr><td colspan=1>&nbsp;</td><td>+---</td><td colspan=2><b>write</b></td></tr>
 * <tr><td colspan=2>&nbsp;</td><td>+---</td><td colspan=2>insert</td></tr>
 * <tr><td colspan=2>&nbsp;</td><td>+---</td><td colspan=2><b>modify</b></td></tr>
 * <tr><td colspan=3>&nbsp;</td><td>+---</td><td>update</td></tr>
 * <tr><td colspan=3>&nbsp;</td><td>+---</td><td>delete</td></tr>
 * </table>
 * <p>
 * Service elements structured in such a way are denoted by a {@link tb.util.QualifiedName}.
 * In the above structure the individual service elements' fully qualified names are
 * <ul>
 * <li>full.select
 * <li>full.write.insert,
 * <li>full.write.modify.update, and
 * <li>full.write.modify.delete.
 * </ul>
 * The compound services' qualified names are
 * <ul>
 * <li>full,
 * <li>full.write, and
 * <li>full.write.modify.
 * </ul>
 *
 * @author Thomas Barnekow
 * @version 1.0
 */
public interface Provider extends NamedObject {

  public static final QualifiedName SERVICE = new QualifiedName("service");

	/**
	 * Provide a certain type of <code>service</code> relating to a specified
   * <code>entity</code>.
	 *
	 * @param service	individual service element or compound service
	 * @param entity	element or container
	 */
	public void provide(QualifiedName service, QualifiedName entity);

	/**
	 * Does this service provider render the specified <code>service</code> relating
   * to the given <code>entity</code>?
	 *
	 * @param service	individual service element or compound service
	 * @param entity	element or container
	 */
	public boolean isProvider(QualifiedName service, QualifiedName entity);
}
